/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.urbansoft.icl.record;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.urbansoft.icl.field.Field;
import org.urbansoft.icl.field.GenericAField;
import org.urbansoft.icl.field.GenericANField;
import org.urbansoft.icl.field.GenericANSField;
import org.urbansoft.icl.field.GenericBlankField;
import org.urbansoft.icl.field.GenericNBField;
import org.urbansoft.icl.field.GenericNField;
import org.urbansoft.icl.field.Position;
import org.urbansoft.icl.field.validation.RecordTypeValidator;
import org.urbansoft.icl.util.EasternStandardTime;

/**
 * 
 * @author Ricardo Reyes
 */
public class ReturnAddendumARecord extends Record {
	public Field recordType;
	public Field returnAddendumARecordNumber;
	public Field returLocationRoutingNumber;
	public Field bofdBusinessDate;
	public Field bofdItemSequenceNumber;
	public Field depositAccountNumber;
	public Field bofdDepositBranch;
	public Field payeeName;
	public Field truncationIndicator;
	public Field bofdConversionIndicator;
	public Field bofdCorrectionIndicator;
	public Field userField;
	public Field reserved;
	public Field userField2;

	static Logger log = Logger.getLogger(ReturnAddendumARecord.class);

	/**
	 * Instantiates a new check detail addendum a record.
	 */
	public ReturnAddendumARecord() {
		fields = new ArrayList<Field>();
		recordName = "Return Addendum A Record";
		recordTypeNumber = "32";
		initFields();
	}

	private void initFields() {
		try {
			/* cash header record */
			recordType = new GenericNField(new Position(1, 2),
					RecordTypeValidator.INSTANCE, "32", "Record Type");

			/* check detail addendum a record number */
			returnAddendumARecordNumber = new GenericANSField(
					new Position(3, 3), "Check Detail Addendum A Record Number");
			returnAddendumARecordNumber.setFieldData("");

			/* bofd routing number */
			returLocationRoutingNumber = new GenericANSField(
					new Position(4, 12), "BOFD Routing Number");
			returLocationRoutingNumber.setFieldData("");

			/* bofd business date */
			bofdBusinessDate = new GenericANSField(new Position(13, 20),
					"BOFD Business Date");
			bofdBusinessDate.setFieldData(EasternStandardTime
					.getCurrentDateInEST());

			/* bofd item sequence number */
			bofdItemSequenceNumber = new GenericANSField(new Position(21, 35),
					"BOFD Item Sequence Number");
			bofdItemSequenceNumber.setFieldData("");

			/* bofd deposit account number */
			depositAccountNumber = new GenericANSField(new Position(36, 53),
					"Deposit Account Number At BOFD");
			depositAccountNumber.setFieldData("");

			/* bofd deposit branch */
			bofdDepositBranch = new GenericANSField(new Position(54, 58),
					"BOFD Deposit Branch");
			bofdDepositBranch.setFieldData("");

			/* payee name */
			payeeName = new GenericANSField(new Position(59, 73), "Payee Name");
			payeeName.setFieldData("");

			/* truncation indicator */
			truncationIndicator = new GenericANSField(new Position(74, 74),
					"Truncation Indicator");
			truncationIndicator.setFieldData("");

			/* bofd conversion indicator */
			bofdConversionIndicator = new GenericANSField(new Position(75, 75),
					"BOFD Conversion Indicator");
			bofdConversionIndicator.setFieldData("");
			/* bofd correction indicator */
			bofdCorrectionIndicator = new GenericANSField(new Position(76, 76),
					"BOFD Correction Indicator");
			bofdCorrectionIndicator.setFieldData("");

			/* user field */
			userField = new GenericANSField(new Position(77, 77), "User Field");
			userField.setFieldData("");

			/* reserved */
			reserved = new GenericANSField(new Position(78, 79), "Reserved");
			reserved.setFieldData("");

			userField2 = new GenericANSField(new Position(80, 90), "User Field");
			userField2.setFieldData("");

			fields.add(recordType);
			fields.add(returnAddendumARecordNumber);
			fields.add(returLocationRoutingNumber);
			fields.add(bofdBusinessDate);
			fields.add(bofdItemSequenceNumber);
			fields.add(depositAccountNumber);
			fields.add(bofdDepositBranch);
			fields.add(payeeName);
			fields.add(truncationIndicator);
			fields.add(bofdConversionIndicator);
			fields.add(bofdCorrectionIndicator);
			fields.add(userField);
			fields.add(reserved);
			fields.add(userField2);

		} catch (Exception e) {
			log.fatal(e.getMessage(), e);
		}
	}
}
